home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 May
/
EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso
/
softwareupdate
/
system
/
amigados
/
filefunctions
/
example2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-10
|
3KB
|
87 lines
/***********************************************************/
/* */
/* Amiga C Encyclopedia (ACE) Amiga C Club (ACC) */
/* -------------------------- ------------------ */
/* */
/* Manual: AmigaDOS Amiga C Club */
/* Chapter: File Functions Tulevagen 22 */
/* File: Example2.c 181 41 LIDINGO */
/* Author: Anders Bjerin SWEDEN */
/* Date: 93-03-15 */
/* Version: 1.0 */
/* */
/* Copyright 1993, Anders Bjerin - Amiga C Club (ACC) */
/* */
/* Registered members may use this program freely in their */
/* own commercial/noncommercial programs/articles. */
/* */
/***********************************************************/
/* This example demonstrates how to rename files and directories. */
/* It will rename a file on the Ram disk called "HighScore.dat" to */
/* "Numbers.dat". It will also rename the directory the previous */
/* Example created ("MyDirectory") to "NewDirectory". */
/* (Please run Example 1 in the "Files" chapter to create the */
/* "HighScore.dat" file before you run this example.) */
/* Include the dos library definitions: */
#include <dos/dos.h>
/* Now we include the necessary function prototype files: */
#include <clib/dos_protos.h> /* General dos functions... */
#include <stdio.h> /* Std functions [printf()...] */
#include <stdlib.h> /* Std functions [exit()...] */
/* Set name and version number: */
UBYTE *version = "$VER: AmigaDOS/FileFunctions/Example2 1.0";
/* Declared our own function(s): */
/* Our main function: */
int main( int argc, char *argv[] );
/* Main function: */
int main( int argc, char *argv[] )
{
/* A simple boolean variable: */
BOOL ok;
/* Rename the file: */
ok = Rename( "RAM:HighScore.dat", "RAM:Numbers.dat" );
/* Check if the file was successfully renamed: */
if( ok )
printf( "The file was successfully renamed!\n" );
else
printf( "Error! The file could not be renamed!\n" );
/* Rename the directory: */
ok = Rename( "RAM:MyDirectory", "RAM:NewDirectory" );
/* Check if the directory was successfully renamed: */
if( ok )
printf( "The directory was successfully renamed!\n" );
else
printf( "Error! The directory could not be renamed!\n" );
/* The End! */
exit( 0 );
}